<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>


<body>
    <div class="container right-panel-active">
        <div class="container_from container--signup">
            <form action="#" class="form" id="form1">
                <h2 class="form_title">注册账号</h2>
                <input type="text" placeholder="User" class="input">
                <input type="password" placeholder="Password" class="input">
                <input type="email" placeholder="Email" class="input">
                <button class="btn">点击注册</button>
            </form>
        </div>
        <div class="container_from container--signin">
            <form action="#" class="form" id="form2">
                <h2 class="form_title">欢迎登录</h2>
                <input type="text" placeholder="User" class="input">
                <input type="password" placeholder="Password" class="input">
                <a href="#" class="link">忘记密码？</a>
                <button class="btn">登录</button>
            </form>
        </div>

        <div class="container_overlay">
            <div class="overlay">
                <div class="overlay_panel overlay--left">
                    <button class="btn" id="signin">已有账号，直接登录</button>
                </div>
                <div class="overlay_panel overlay--right">
                    <button class="btn" id="signup">没有账号，点击注册</button>
                </div>
            </div>


        </div>
    </div>
    </div>

</body>
<script>
    const signinBtn = document.getElementById("signin");
    const signupBtn = document.getElementById("signup");
    const fistForm = document.getElementById("form1");
    const secondForm = document.getElementById("form2");
    const container = document.querySelector(".container")

    signinBtn.addEventListener("click", () => {
        container.classList.remove("right-panel-active");
    })
    signupBtn.addEventListener("click", () => {
        container.classList.add("right-panel-active");
    })
    fistForm.addEventListener("submit", (e) => e.preventDefault())
    secondForm.addEventListener("submit", (e) => e.preventDefault())

</script>

</html>